package org.example.system.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.example.system.incterceptor.JwtAuthInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;

/**
 * @author Yinshijay
 */
public class WebAppConfig implements WebMvcConfigurer {
    @Bean
    public JwtAuthInterceptor jwtAuthInterceptor(){
        return new JwtAuthInterceptor();
    }

    @Bean
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtAuthInterceptor())
                .addPathPatterns("/api/v1/wx/**")
                .excludePathPatterns
                        (Arrays.asList(
                                "/api/v1/wx/login"
                        ));
    }


}
